# -*- coding: utf-8 -*-
from common import orm
from common.utils.types import Enum

TASK_CONF = [
    {'name': u'充值100', 'bit': 1, 'add_times': 1},
    {'name': u'充值200', 'bit': 2, 'add_times': 1},
    {'name': u'充值500', 'bit': 4, 'add_times': 1},
    {'name': u'充值1000', 'bit': 8, 'add_times': 1},
]

DOUBLE_RATIO = [
    {'start': 1, 'end': 10, 'bit': 1, },
    {'start': 10, 'end': 30, 'bit': 2, },
    {'start': 30, 'end': 50, 'bit': 4, },
    {'start': 50, 'end': 52, 'bit': 8, },
    {'start': 52, 'end': 62, 'bit': 16, },
    {'start': 62, 'end': 68, 'bit': 32, },
    {'start': 68, 'end': 88, 'bit': 64, },
    {'start': 88, 'end': 100, 'bit': 128, }
]

AWARD_RATIO = [
    {'start': 1, 'end': 55, 'tid': [7], 'name': u'1元红包', },
    {'start': 55, 'end': 80, 'tid': [8], 'name': u'2元红包', },
    {'start': 80, 'end': 90, 'tid': [12, 13, 14, 15, 16], 'name': u'随机直减红包', },
    {'start': 90, 'end': 95, 'tid': [17], 'name': u'免费重庆时时彩一注', },
    {'start': 95, 'end': 96, 'tid': [9], 'name': u'5元红包', },
    {'start': 1, 'end': 0, 'tid': [10], 'name': u'10元红包', },
    {'start': 1, 'end': 0, 'tid': [11], 'name': u'88元红包', },
    {'start': 96, 'end': 100, 'tid': [18], 'name': u'免费快3一注', }
]


class FortuneWheel(orm.Model):
    """
    每日转盘活动
    """
    __tablename__ = "fortune_wheel"
    id = orm.Column(orm.BigInteger, primary_key=True)
    user_id = orm.Column(orm.Integer)
    date = orm.Column(orm.VARCHAR)
    left_normal_times = orm.Column(orm.Integer)  # 剩余普通次数
    apply_normal_times = orm.Column(orm.Integer)  # 已参与普通次数
    left_double_times = orm.Column(orm.Integer)  # 剩余双倍次数
    apply_double_times = orm.Column(orm.Integer)  # 已参与双倍次数
    task_status = orm.Column(orm.Integer)  # 当前的任务完成情况, JSON
    created_at = orm.Column(orm.DATETIME)
    updated_at = orm.Column(orm.DATETIME)


class FortuneWheelAward(orm.Model):
    """
    转盘活动中奖记录 
    """
    __tablename__ = "fortune_wheel_award"
    id = orm.Column(orm.BigInteger, primary_key=True)
    user_id = orm.Column(orm.Integer)
    date = orm.Column(orm.VARCHAR)
    is_double = orm.Column(orm.Integer)  # 是否双倍
    award_index = orm.Column(orm.Integer)  # 奖品序号，从0开始
    status = orm.Column(orm.Integer)  # 中奖状态 1 2 4
    created_at = orm.Column(orm.DATETIME)
    updated_at = orm.Column(orm.DATETIME)
